package com.abkj.platform.tail.socket;

import java.io.IOException;
import java.nio.CharBuffer;
import java.util.List;
import org.apache.catalina.websocket.MessageInbound;
import org.apache.catalina.websocket.WsOutbound;

public class SocketUtil
{
  public static void notifyGuest(String data)
  {
    List<MessageInbound> guests = SocketServlet.getSocketList();
    if (guests == null) return;
    for (MessageInbound mi : guests)
      try {
        mi.getWsOutbound().writeTextMessage(CharBuffer.wrap(data));
      } catch (IOException e) {
        e.printStackTrace();
      }
  }
}